/**
 * org.vz.product.collect.maintain.service.impl
 * @since : jdk 1.8
 */
package org.vz.product.collect.maintain.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.vz.product.collect.maintain.dao.DistributedDao;
import org.vz.product.collect.maintain.domain.DistributedEntity;
import org.vz.product.collect.maintain.domain.entity.GetDistributedEntityResult;
import org.vz.product.collect.maintain.service.DistributedService;

/**
 * @author morik is Yongxu.Wang 分布式查询
 * @CreateTime 2017年11月02日 15:46:30
 * @version 1.0.0
 * @description
 */
@Service
public class DistributedServiceImpl implements DistributedService {
	@Autowired
	DistributedDao distributedDao;

	@Override
	public GetDistributedEntityResult getDistributedEntity(int type,
			String startTime, String endTime) {
		GetDistributedEntityResult gr = new GetDistributedEntityResult();
		Map<String, String> par = new HashMap<String, String>();
		par.put("type", type + "");
		par.put("startTime", startTime);
		par.put("endTime", endTime);
		List<DistributedEntity> dtas;
		if(type==0){  
			dtas = distributedDao.getSQLManager().select(
					"messagelog.getAllDistributed", DistributedEntity.class, par);
		}else{
			dtas = distributedDao.getSQLManager().select(
					"messagelog.getDistributed", DistributedEntity.class, par);
		}
		if (dtas != null) {
			gr.data = dtas;
			gr.msg = "查询成功!!!";
			gr.status = 1;
		}
		return gr;
	}
}
